<?php
/**
 * 【接口隔离原则】
 * 不要实现用不到的接口方法，只实现用到的方法
 * User: Fitz
 * Date: 2018/8/9
 * Time: 17:38
 */

interface Food
{
    public function eat();
}

interface Drinks
{
    public function drink();
}

class Bread implements Food
{
    public function eat()
    {
        // TODO: Implement eat() method.
    }
}

class Coke implements Drinks
{
    public function drink()//coke可以被喝
    {
        // TODO: Implement fly() method.
    }
}

/**
 * 人
 * Class Zoo
 */
class Person
{
    public function buyDrinks(Drinks $drinks)
    {
        $drinks->drink();
    }

    public function buyFood(Food $food)
    {
        $food->eat();
    }
}

$person = new Person();
$person->buyDrinks(new Coke());
$person->buyFood(new Bread());